class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int t) {
        unordered_map<int,int> hash;
        for(int i=0;i<nums.size();++i)
        {
            int cur=t-nums[i];
            if(hash.find(cur)!=hash.end())
                return {hash[cur],i};
            else
                hash[nums[i]]=i;
        }
        return {};
    }
};
